home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 23
/
Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso
/
Aminet
/
biz
/
swood
/
fwcalc.lha
/
FWCalcAddSpalte.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1997-08-30
|
3KB
|
142 lines
/* $VER: 0.11 , (29.08.1997), © by Thorsten Willert
Macro um Tabellenspalten zu addieren (den Inhalt
in Zahlen natürlich)
-------------------------------------------------
Voreinstellungen: */
Info = 1
/*----------------------------------------------*/
ADDRESS = 'FinaW'
OPTIONS CACHE RESULTS
STATUS PORTNAME
FW = RESULT
ADDRESS = FW
SIGNAL ON BREAK_C
SIGNAL ON HALT
SIGNAL ON SYNTAX
/*-----------------------------------------------*/
RT.Title = "FWAddSpalte"
RT.Para1 = "rtez_flags = ezreqf_centertext"
RT.Para2 = "rt_pubscrname = FinalWriterPubScreen rtfi_flags = freqf_selectdirs"
Copyright = RT.Title || ", © 1997, by Thorsten Willert"
R = '0A'X
Zahlen = "1234567890,.-"
/*-----------------------------------------------*/
IF ~show('L',"rexxreqtools.library") THEN DO
IF ~addlib('rexxreqtools.library',0,-30,0) THEN DO
'ShowMessage 1 1 "Fehler ..." "Benötige RexxReqTools.library!" "" "Abbruch !!" "" ""'
EXIT 20
END
END
IF Info=1 THEN CALL Info
ADDRESS (FW)
GETDocItemPrefs Decimal
Punkt = result
CALL SetCursor
CALL Addieren
/*-----------------------------------------------*/
Ende:
EXIT
/*-----------------------------------------------*/
SetCursor:
ADDRESS(FW)
TableGetActiveCell
PARSE VAR RESULT Zeile Spalte
TableGetRows
PARSE VAR RESULT Muell Zeilen
IF Zeile=1 | Zeile=Zeilen THEN Zeile=2
TableSetAvticeCell Zeile Spalte
RETURN
/*-----------------------------------------------*/
Addieren:
ADDRESS (FW)
i=1;Summand=0;Summe=0
DO FOREVER
i=i+1
TableSetActiveCell Zeile Spalte
SelectAll
Extract
Summand=COMPRESS(Result,'09'X'0A'X" ")
IF ~VERIFY( Summand, Zahlen) ~=0 THEN
DO
Justify Right
Summand=TRANSLATE(Summand,".",",")
IF Summand = "" THEN Summand = 0
END
ELSE Summand=0
Summe=Summe+Summand
IF Zeile=Zeilen-1 THEN LEAVE
Zeile=Zeile+1
END
TableSetActiveCell Zeilen Spalte
SelectAll
Justify Right
Clear
Style Bold
IF Punkt~="Period" THEN Summe=TRANSLATE(Summe,",",".")
Type Summe
RETURN
/*-----------------------------------------------*/
Info:
rtezrequest(Copyright || R || R ||,
"Addiert Spalten ab Cursorposition." || R ||,
"Die erste Zeile wird nie mitaddiert"||R||,
"und in der letzen steht immer das Ergebnis!","_Aha",RT.Title)
RETURN
/*-----------------------------------------------*/
HALT:
BREAK_C:
rtezrequest("Macro wurde abgebrochen ... ","Weiter",RT.Title,RT.Para1)
EXIT 10
/*-----------------------------------------------*/
SYNTAX:
IF RC = 47 THEN
rtezrequest("Fehler!","_Weiter|_Hilfe",RT.Title,RT.Para1)
IF rtresult == 0 THEN CALL Info
EXIT 10